var amapFile = require('./amap-wx.js')
var myAmapFun = new amapFile.AMapWX({key:'e4b9b4d426690781d5443937b4a80f49'})
class Amap {
  /**
   * 获取POI数据
   * @param {string} querykeywords
   * @param {string} location
   */
  static getPoiAround(querykeywords = '', location) {
    return new Promise((resolve, reject) => myAmapFun.getPoiAround({ querykeywords, location, success: resolve, fail: reject }));
  }

  /**
   * 获取地理描述数据
   */
  static getRegeo(location) {
 
    return new Promise((resolve, reject) => myAmapFun.getRegeo({ location, success: resolve, fail: reject }));

  }
  /**
   * 获取天气数据
   *
   */
  static getWeather() {
    return new Promise((resolve, reject) => myAmapFun.getWeather({ success: resolve, fail: reject }));
  }

  /**
   * 获取输入提示词
   * @param {string} keywords 
   * @param {string} location 
   */
  static getInputtips(city, location = '', keywords = '', citylimit) {
    return new Promise((resolve, reject) => myAmapFun.getInputtips({ keywords, location, city, citylimit, success: resolve, fail: reject }));
  }

  /**
   * 获取路线规划
   * type : getDrivingRoute --驾车
   * type : getWalkingRoute --步行
   * type : getTransitRoute --公交
   * type : getRidingRoute --骑行
   * @param {string} origin 
   * @param {string} destination 
   */
  static getRoute(origin, destination, type, city) {
    return new Promise((resolve, reject) => myAmapFun[type]({ origin, destination, city, success: resolve, fail: reject }));
  }
}

module.exports = Amap;